/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.model.bo.excel.asset;

import cn.ac.nercis.pes.model.dto.evaluation.prepare.PersonnelDTO;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import org.apache.commons.lang3.StringUtils;

/**
 * 人员（系统资产）资产信息类（导出/导入）
 * @author zpy
 * @version 1.0.0
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PersonnelBO extends BaseExcelBO {

    @ExcelProperty(value = "*姓名",order = 1)
    private String name;
    @ExcelProperty(value = "*岗位/角色",order = 2)
    private String role;
    @ExcelProperty(value = "*职责说明",order = 3)
    private String desc;
    @ExcelProperty(value = "*联系方式",order = 4)
    private String tel;

    @ExcelIgnore
    private PersonnelDTO source;

    public boolean isEmpty(){
        return StringUtils.isAllBlank(name,role,desc,tel);
    }

    public boolean validRequired(){
        return !StringUtils.isAnyBlank(name,role,desc,tel);
    }

    public boolean equalsDTO(@NonNull PersonnelDTO dto){
        return StringUtils.equals(name,dto.getName())
                && StringUtils.equals(role,dto.getRole())
                && StringUtils.equals(desc,dto.getDesc())
                && StringUtils.equals(tel,dto.getTel());
    }
}